package com.zpark.pojo;

import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.*;

import lombok.Data;
@Data
public class User {
    @NotBlank(message = "姓名不允许为空")
    @Length(min = 2,max = 10,message = "姓名长度错误，长度长度2-10！")
    private String name;

    @NotNull(message = "年龄不能为空")
    @Min(value = 18,message = "年齡最小不能小于18")
    private int age;

    @NotBlank(message = "地址不能为空")
    private String address;

    @Pattern(regexp = "^1(3[0-9]|5[012356789]|7[1235678]|8[0-9])\\d{8}$", message ="手机号格式错误")
    private String phone;

    @Email(message = "邮箱格式错误")
    private String email;

    //省略get、set方法
}